//
//  KDMonitorRequestTool.m
//  PublicSentimentMonitorSystem
//
//  Created by 魏强 on 15/11/6.
//  Copyright © 2015年 魏强. All rights reserved.
//

#import "KDMonitorRequestTool.h"
#import "KDBaseTool.h"
#import "KDBaseParam.h"
#import "KDBaseResult.h"
#import "KDMGetKeyWordListResult.h"
#import "KDMGetWebListResult.h"
#import "KDMGetAuthorListResult.h"
#import "KDMGetWeiboListResult.h"
#import "KDGetMonitorListParam.h"
#import "KDMKeywordMonitorResult.h"
#import "KDWebMonitorResult.h"
#import "KDWeiboMonitorResult.h"
#import "KDMGetSetUpListParam.h"
#import "KDMGetSetUpListResult.h"
#import "KDMDeleteParam.h"
#import "KDMWebAddResult.h"
#import "KDMKeywordAddResult.h"
#import "WebsiteMonitorGetResult.h"
#import "WebsiteMonitorGetParam.h"
#import "findWebBloclListParam.h"
#import "findWebBloclListResult.h"
#import "AddWebBlockParam.h"
#import "AddWebBlockResult.h"
#import "WebsiteAddParam.h"
#import "KDDeleteWebBlockParam.h"
#import "KDDeleteWebBlockResult.h"
#import "KDMGetAppListResult.h"
#import "KDStatusResult.h"

@implementation KDMonitorRequestTool
/**
 *  获取关键字监测的所有子主题
 */
+ (void)getWithParam:(KDBaseParam *)param WithMainType:(NSInteger)mainType success:(void (^)(KDStatusResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    switch (mainType) {
        case 0:
            [KDBaseTool get:url param:param resultClass:[KDMGetKeyWordListResult class] success:success failure:failure];
            break;
        case 1:
            [KDBaseTool get:url param:param resultClass:[KDMGetWebListResult class] success:success failure:failure];
            break;
        case 2:
            [KDBaseTool get:url param:param resultClass:[KDMGetAuthorListResult class] success:success failure:failure];
            break;
        case 3:
            [KDBaseTool get:url param:param resultClass:[KDMGetAppListResult class] success:success failure:failure];
            break;
        default:
            break;
    }
    
}
/**
 *  获取监测首页的关键字列表数据
 */
+ (void)getMonitorListWithParam:(KDGetMonitorListParam *)param WithMainType:(NSInteger)mainType success:(void (^)(KDMKeywordMonitorResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url;
    if (mainType == 5) {//相关界面进来的
        url = [NSString stringWithFormat:@"%@&isSimlarReport=false",ServerActionAddr];
    }else{
        url = ServerActionAddr;
    }
//    switch (mainType) {
//        case 0:
            [KDBaseTool get:url param:param resultClass:[KDMKeywordMonitorResult class] success:success failure:failure];
//            break;
//        case 1:
//            [KDBaseTool get:url param:param resultClass:[KDMKeywordMonitorResult class] success:success failure:failure];
//            break;
//        case 2:
//            [KDBaseTool get:url param:param resultClass:[KDMKeywordMonitorResult class] success:success failure:failure];
//            break;
//        case 3:
//            [KDBaseTool get:url param:param resultClass:[KDMKeywordMonitorResult class] success:success failure:failure];
//            break;
//        default:
//            break;
//    }
//
}


/**
 *  获取监测设置页面的列表数据
 */
+ (void)getSetUpListWithParam:(KDMGetSetUpListParam *)param WithMainType:(NSInteger)mainType success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    switch (mainType) {
        case 0:
            [KDBaseTool get:url param:param resultClass:[KDMGetKeyWordListResult class] success:success failure:failure];
            break;
        case 1:
            [KDBaseTool get:url param:param resultClass:[KDMGetWebListResult class] success:success failure:failure];
            break;
        case 2:
            [KDBaseTool get:url param:param resultClass:[KDMGetAuthorListResult class] success:success failure:failure];
            break;
        default:
            break;
    }
}
/**
 *  删除某个主题
 */
+ (void)deleteMonitorWithParam:(KDMDeleteParam *)param WithMainType:(NSInteger)mainType success:(void (^)(KDBaseResult * responseObejct))success failure:(void(^)(NSError *error))failure{
     NSString *url = ServerActionAddr;
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];

}

/**
 *  添加一个关键字主题（编辑也用这个）
 */
+ (void)addKeywordMonitorWithParam:(KDMKeywordAddParam *)param success:(void (^)(KDMKeywordAddResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool post:url param:param resultClass:[KDMKeywordAddResult class] success:success failure:failure];
}
/**
 *  添加网站主题
 */
+ (void)addWebMonitorWithParam:(WebsiteAddParam *)param success:(void (^)(KDMWebAddResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool post:url param:param resultClass:[KDMWebAddResult class] success:success failure:failure];
}
/**
 *  获取输入网址所属网站
 */
+ (void)websiteMonitorGetWithParam:(WebsiteMonitorGetParam *)param success:(void (^)(WebsiteMonitorGetResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool get:url param:param resultClass:[WebsiteMonitorGetResult class] success:success failure:failure];
}

/**
 *  拉取网站板块的子板块列表
 */
+ (void)findWebBlocklListMonitorWithParam:(findWebBloclListParam *)param success:(void (^)(findWebBloclListResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool get:url param:param resultClass:[findWebBloclListResult class] success:success failure:failure];
}
/**
 *  添加子板块
 */
+ (void)addWebBlockMonitorWithParam:(AddWebBlockParam *)param success:(void (^)(AddWebBlockResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool get:url param:param resultClass:[AddWebBlockResult class] success:success failure:failure];
}
/**
 *  删除子板块
 */
+ (void)deleteWebBlockMonitorWithParam:(KDDeleteWebBlockParam *)param success:(void (^)(KDDeleteWebBlockResult * responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = ServerActionAddr;
    [KDBaseTool get:url param:param resultClass:[KDDeleteWebBlockResult class] success:success failure:failure];
}
@end
